<!-- Display "X no. of friends have bet" link -->
<%	
  # Performance considerations
  # Since size has been determined from SQL, no additional queries required
  # If the sql does not have 'friends_count', the query is not executed
  # the else condition is for compatibility with older versions 
  if local_assigns.has_key?(:match)
    size = match.try(:friends_count) || match.bets.friends(current_user.all_friends).size
  else
    size = Match.find(sid).bets.friends(current_user.all_friends).size
  end
%>
<%if size > 0%>
	<a  href="#"  onclick="toggle_expend(<%=sid%>);do_ajax(Ajax.FBML,'<%=@call_back_url%>','friends_bet',<%=sid%>); return false;" class="comments" id="friend_link_<%=sid%>"><span style="font-weight:bold">
		<span clicktohide="show_friends_bet_span_<%=sid%>" clicktoshow = "hide_friends_bet_span_<%=sid%>, render_friends_bet_layout_<%=sid%>,friends_bet_indicator_<%=sid%>"  class="show_span" id="show_friends_bet_span_<%=sid%>" style='padding-left:15px'>
				<span class='menu_arrow' onmouseover="setgray(this)"  onmouseout="setblack(this)"><%=pluralize(size,"Friend")%> <%=(size == 1 ? "has" : "have")%> bet</span>
		</span>
		<span clicktohide="hide_friends_bet_span_<%=sid%>, render_friends_bet_layout_<%=sid%>, friends_bet_indicator_<%=sid%>" clicktoshow = "show_friends_bet_span_<%=sid%>" class="hide_span" id="hide_friends_bet_span_<%=sid%>" style='padding-left:15px;display:none'>
			<span class='menu_arrow' onmouseover="setgray(this)" onmouseout="setblack(this)"><%=pluralize(size,"Friend")%> <%=(size == 1 ? "has" : "have")%> bet</span>
		</span>
	
	</a>

<%else%>
	<%=render :partial=>'friends_bet/place_new_ch_link',:locals=>{:sid=>sid,:u=>nil,:match=>Match.find(sid)}%>
<%end%>
